
<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:useBean id="now" class="java.util.Date" scope="page"/>
<html>
<head>
    <title>详情</title>
    <meta name="author" content="详情"/>
    <meta name="keywords" content="详情"/>
    <meta name="description" content="详情"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <link href="/Components/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="/Components/js/jquery-1.7.2.min.js"></script>
    <script src="/Components/js/common.js" type="text/javascript"></script>

    <script type="/Components/text/javascript" src="/Components/js/jquery.form.js"></script>
    <script type="text/javascript" src="/Components/js/jquery.form.js"></script>

</head>
<body>
<!--顶部开始-->
<div id="top">

    <div style="margin-bottom:55px;">
        <div id="toolbar">
            <div class="fixed-green">
                <a class="ui-title" id="popmenu">
                    <c:if test="${detail != null}">
                        修改
                    </c:if>
                    <c:if test="${detail == null}">
                        增加
                    </c:if>
                </a>
                <a class="ui-btn-back" href="javascript:history.go(-1)"></a><a class="ui-btn-home" href="/"></a></div>
        </div>

        <div id="window">
            <ul class="windowlist">
                <li><a href="/"><span>网站首页</span></a></li>
                <li><a href="About.html"><span>关于我们</span></a></li>
                <li><a href="News.html"><span>资讯中心</span></a></li>
                <li><a href="Product.html"><span>产品中心</span></a></li>
                <li><a href="Case.html"><span>案例展示</span></a></li>
                <li><a href="video.html"><span>视频展示</span></a></li>
                <li><a href="Merchants.html"><span>招商加盟</span></a></li>
                <li><a href="Recruitment.html"><span>招贤纳士</span></a></li>
                <li><a href="Message.html"><span>在线留言</span></a></li>
                <li><a href="Contact.html"><span>联系我们</span></a></li>
                <div class="clear"></div>
            </ul>
        </div>
    </div><!--频道导航 结束--></div><!--顶部结束-->
<div id="content">
    <div class="guestbook">
        <ul class="wxlist">
            <li>
                <div class="ChannelName"><h1>
                    <c:if test="${detail != null}">
                        修改
                    </c:if>
                    <c:if test="${detail == null}">
                        增加
                    </c:if>
                </h1></div>
                <table border="0" cellpadding="0" cellspacing="3" class="guestbooktable">
                    <form method="post" id="frm" action="#" onsubmit="return false">
                        <input type="hidden" id="type" name="type" value="${detail == null?'add':'update'}">
                        <input type="hidden" id="guid" name="guid" value="${detail == null?'':detail.guid}">
                        <tr>
                            <td class="t1"><span class="required">服务器名称*</span></td>
                            <td class="t2"><input name="servername" id="servername" type="text" maxlength="20"
                                                  value="${detail.servername}"/></td>
                        </tr>
                        <tr>
                            <td class="t1"><span class="required">开放时间*</span></td>
                            <td class="t2"><input name="opendate" id="opendate" type="datetime" maxlength="100" value="${detail.opendate}"/></td>
                        </tr>
                        <tr>
                            <td class="t1"><span class="required">详细介绍*</span></td>
                            <td class="t2"><textarea id="present" name="present" maxlength="40">${detail.present}</textarea></td>
                        </tr>
                        <tr>
                            <td class="t1"><span class="required">线路类别*</span></td>
                            <td class="t2"><input id="linetype" name="linetype" type="text" maxlength="100"
                                                  value="${detail.linetype}"/></td>
                        </tr>
                        <tr>
                            <td class="t1"><span class="required">客服QQ*</span></td>
                            <td class="t2"><input id="qq" name="qq" type="text" maxlength="20" value="${detail.qq}"/></td>
                        </tr>
                        <tr>
                            <td class="t1"><span class="required">链接地址*</span></td>
                            <td class="t2"><input id="url" name="url" type="text" maxlength="100" value="${detail.url}"/></td>
                        </tr>
                        <tr>
                            <td class="t1"><span class="required">排序*</span></td>
                            <td class="t2"><input id="sort" name="sort" type="text" maxlength="10" value="${detail.sort}"/></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <input class="ui-btn-submit" type="button" onclick="submitForm()" name="submit" value="提交"/>
                            </td>
                        </tr>
                    </form>
                </table>
            </li>
        </ul>
    </div>
</div>

</body>
</html>
<script type="text/javascript">
    function submitForm(){
        console.log( $("#frm").serialize())
        console.log($("#opendate").val())
        var data = {
            type: $("#type").val(),
            guid: $("#guid").val(),
            servername: $("#servername").val(),
            //opendate: $("#opendate").val(),
            present: $("#present").val(),
            linetype: $("#linetype").val(),
            qq: $("#qq").val(),
            url: $("#url").val(),
            sort: $("#sort").val()
        }
        $.ajax({
            type: "post",
            url: "/admin/add",
            data: data,
            success: function (res){
                if(res.succ){
                    alert(res.msg);
                    window.location.href = "list";
                }else{
                    alert(res.msg);
                }
            },
            error : function (res){
                console.log(res);
                alert("服务器运行出错，请联系管理员！")
            }
        });
    }
</script>
<script type="text/javascript">
    /*$.fn.datetimepicker.dates['zh'] = {
        days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
        daysShort: ["日", "一", "二", "三", "四", "五", "六", "日"],
        daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
        months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        monthsShort: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
        meridiem: ["上午", "下午"],
        //suffix:      ["st", "nd", "rd", "th"],
        today: "今天"
    };*/
   /* $("#starttime,#endtime").datetimepicker({
        language: 'zh',  //用自己设置的时间文字
        //weekStart: 1,  //一周从那天开始，默认为0，从周日开始，可以设为1从周一开始
        // startDate:"2018-5-20", //开始时间，可以写字符串，也可以直接写日期格式new Date(),在这之前的日期不能选择
        //endDate:"2018-6-20",
        //daysOfWeekDisabled: [0,4,6],  //一周的周几不能选
        todayBtn: 1,  //是否显示今天按钮，0为不显示
        autoclose: 1, //选完时间后是否自动关闭
        todayHighlight: 1,  //高亮显示当天日期
        startView: 2, //0从小时视图开始，选分;1	从天视图开始，选小时;2从月视图开始，选天;3从年视图开始，选月;4从十年视图开始，选年
        minView: 0,//最精确时间，默认0；0从小时视图开始，选分；1从天视图开始，选小时；2从月视图开始，选天；3从年视图开始，选月；4从十年视图开始，选年
        //maxView:4,  //默认值：4, ‘decade’
        //keyboardNavigation:true,  //是否可以用键盘方向键选日期，默认true
        forceParse: 0, //强制解析,你输入的可能不正规，但是它胡强制尽量解析成你规定的格式（format）
        format: 'yyyy-mm-dd hh:ii:ss',// 格式,注意ii才是分，mm或MM都是月
        minuteStep:5, //选择分钟时的跨度，默认为5分钟
        //pickerPosition:"top-right",  // ‘bottom-left’，’top-right’，’top-left’’bottom-right’
        showMeridian:0, //在日期和小时选择界面，出现上下午的选项,默认false
        // showSecond: false,
        // showMillisec: true,
        //timeFormat: 'hh:mm:ss:l',
        //bootcssVer: 3,
    });*/
</script>
